import pytest
from data.read_data import read_ihrmDelete
from scripts.hm02_api import IhrmLoginApi, IhrmDeleteApi
from scripts.hm03_assert import IhrmDelete


class TestIhrmSearch:
    @pytest.mark.parametrize("emp_id, state_code, success, code, message", read_ihrmDelete())
    def test(self, emp_id, state_code, success, code, message):
        # 登录
        login_data = {"mobile": "13800000002", "password": "123456"}
        login_result = IhrmLoginApi.login(login_data)
        token = login_result.json()["data"]
        # 删除员工
        delete_result = IhrmDeleteApi.update(emp_id, token)
        IhrmDelete.delete_assert(delete_result, state_code, success, code, message)
